import { customRequest } from "./request";
import Taro from "@tarojs/taro";

export const API = {
  /**登录相关 */
  Login: {
    async officialLogin(req: {
      // code: string; // 授权码
      headUrl: string; //头像
      nickname: string; // 昵称
      sex: number; // 性别：0未知1男2女
    }) {
      let { code } = await Taro.login();
      return customRequest.post("studentWeChat/officialLogin", {
        code,
        ...req,
      });
    },

    passLogin() {
      return customRequest.get("auth/passLogin");
    },
  },
  /** 学校相关*/
  School: {
    /**根据学校名查询 */
    search(schoolName: string) {
      customRequest.post(`/baseInfo/getSeniorSchoolBySchoolName/${encodeURIComponent(schoolName)}`);
    },
  },
};
export default API;
